<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="root">
    <!-- 父组件中调用子组件 -->
    <Child>
      <template slot-scope="props">
        <!-- <div>aaaaabbbcc -- {{ props.text }}</div> -->
        <ul>
          <li v-for="item in props.users">{{ item.name }}</li>
        </ul>
      </template>
    </Child>
  </div>


  <!-- 定义组件模板区域 -->
  <script type="text/x-template" id="child">
  <div>
     <!-- 给插槽添加一个自定义属性，属性小写 -->
    <!-- <slot text="插槽中的内容"></slot> -->
    <slot :users="users"></slot>
  </div>
  </script>
  <script src="./js/vue.js"></script>
  <script>
    const Child = {
      template: '#child',
      // 组件内的数据
      data() {
        return {
          users:[
            {id:1,name:'aaa'},
            {id:2,name:'bbb'},
          ]
        }
      }
    }


    new Vue({
      el: '#root',
      data: {
      },
      components: {
        Child
      }
    })
  </script>
</body>

</html>